import Koa from 'koa'
import bindRoute from './decorators/bindRoute'
import {port} from './config'
const app = new Koa()
const db = require('./util/db')
// import home from './controller/home'
// import love from './controller/love'
// router.use('/home', home.routes(), home.allowedMethods())
// router.use('/love', love.routes(), love.allowedMethods())
const cors = require('@koa/cors');
app.use(cors());

var bodyParser = require('koa-bodyparser');
app.use(bodyParser())


bindRoute(app).then(routesMid => {
    app.use(async (ctx, next) => {
        await routesMid(ctx, next)
    })
    app.listen(port)

    console.log(`Server running on 刘明泰加油啊 port ${port}`)
})
